function instanceOf1(left, right) {
  left = left.__proto__;
  right = right.prototype;
  while (true) {
    if (left == right) return true;
    left = left.__proto__;
    if (left == null) return false;
  }
}

console.log(instanceOf1([], Array));
console.log(instanceOf1({}, Object));
